import nodemailer from 'nodemailer'

const emailAccount={
  user: 'tonny_minnly@163.com',
  pass: 'BAIFRWLDIQFJFPWR'
}

const smtpConfig={
  service:'163',
  auth:{
    ...emailAccount

   }

}

const transpoter = nodemailer.createTransport(smtpConfig)

const mailObj = {
  from: 'hhh tonny_minnly@163.com', // 发件人名称+发件人邮箱
  to: '480293335@qq.com', // 收邮件的账号
  subject: 'hello', // 标题
  html: '<html><h1>世界上最最可爱的可爱鬼</h1></html>' // 邮寄的内
}


const send = ()=>transpoter.sendMail(mailObj, (err, info) => {
  if (!err) {
    console.log('邮件已经发生完成')
  }
  console.log('邮件发送成功','====',info)
})

send()                                                                                                                                                                                                                                                                            